package com.global.college.adapter;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.global.college.R;
import com.global.college.ui.bean.InviteHistoryModel;
import com.global.college.views.RoundImageview;

/**
 * 课程
 */
public class InvitePaidAdapter extends BaseQuickAdapter<InviteHistoryModel.ListBean, BaseViewHolder> {

    public InvitePaidAdapter() {
        super(R.layout.item_invite_paid);
    }

    @Override
    protected void convert(BaseViewHolder helper, InviteHistoryModel.ListBean bean) {
        RoundImageview riv = helper.getView(R.id.riv_head);

        Glide.with(mContext).load(bean.getAvatar()).apply(getOption()).into(riv);
        helper.setText(R.id.tv_user_name,bean.getNickName());
        helper.setText(R.id.tv_user_phone,bean.getUserName());
        helper.setText(R.id.tv_invite_price,"￥"+bean.getOrderPrice());
        helper.setText(R.id.tv_pay_time,bean.getPayCompleteTime());
        helper.setText(R.id.tv_invite_train_name,bean.getGoodName());
    }

    private RequestOptions getOption(){
        RequestOptions options = new RequestOptions()
                .placeholder(R.mipmap.icon_user_my_header)//图片加载出来前，显示的图片
                .fallback(R.mipmap.icon_user_my_header) //url为空的时候,显示的图片
                .error(R.mipmap.icon_user_my_header);//图片加载失败后，显示的图片
        return options;
    }

}
